<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib prefix="s" uri="/struts-tags"%>
<html>
<head>
<script language="Javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.tablesorter.js"></script>

<script type="text/javascript" src="js/paging.js"></script>
<script language="JavaScript">
	$(document).ready(
			function() {
				$("#addrow").click(
						function() {

							$('<tr><td>Stuff</td></tr>').insertBefore('#example > tbody > tr:first');

						});
				$("#allsts").change(
						function() {
							var isChecked = $('.selsts').attr('checked') ? true
									: false;
							if (isChecked == false) {
								$(".selsts").attr('checked', true);
							} else {
								$(".selsts").attr('checked', false);
							}

						});

				$('#search').keyup(function() {
					searchTable($(this).val());
				});

				$("#example").tablesorter({
					sortList : [ [ 1, 1 ] ],

					headers : {

						0 : {

							sorter : false
						},

						8 : {

							sorter : false
						},
						9 : {

							sorter : false
						}
					}
				});

				//$('td:nth-child(2),th:nth-child(2)').hide(); 
			});

	function searchTable(inputVal) {
		var table = $('#example');
		table.find('tr').each(function(index, row) {
			var allCells = $(row).find('td');
			if (allCells.length > 0) {
				var found = false;
				allCells.each(function(index, td) {
					var regExp = new RegExp(inputVal, 'i');
					if (regExp.test($(td).text())) {
						found = true;
						return false;
					}
				});
				if (found == true)
					$(row).show();
				else
					$(row).hide();
			}
		});
	}
</script>

<link rel="stylesheet" type="text/css" href="css/style.css">
<style type="text/css">
div#navigation1 {
	cursor: pointer;
}
</style>
<script>
	function PopupCenter(pageURL, title, w, h) {
		var left = (screen.width / 2) - (w / 2);
		var top = (screen.height / 2) - (h / 2);
		var targetWin = window
				.open(
						pageURL,
						title,
						'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='
								+ w
								+ ', height='
								+ h
								+ ', top='
								+ top
								+ ', left=' + left);
	}
	function reload() {
		window.location.href = window.location.href;
	}
</script>
</head>


<body onfocus="reload()">

	<s:actionerror />
	<div id="full_table">

		<button id="addrow">Addrow</button>
		<div align="right">
			<a href="javascript:void(0);"
				onclick="PopupCenter('admin/UploadExcel.jsp','batch',300,300);">Upload
				an Excel Sheet</a>Search Entries:<input type="text" id="search" />
		</div>

		<form id="form" action="deletestaffdetails.action" method="post">
			<table id="example" class="tablesorter" width="100%">
				<thead>
					<tr bgcolor="yellow">
						<th><input type="checkbox" id="allsts" /></th>
						<th>staff_id</th>
						<th>staff_name</th>
						<th>designation</th>
						<th>joining_date</th>
						<th>phone_number</th>
						<th>address_line</th>
						<th>city</th>
						<th>state</th>
						<th>country</th>
						<th>email_id</th>
						<th>staff_type</th>
						<th>role</th>
						<th>roll_number</th><th>acc_no</th>
						<th></th>
						<th></th>
					</tr>
				</thead>
				<tbody>
					<s:iterator value="staff_list">
						<tr>
							<td><input type="checkbox" name="staff_id" class="selsts"
								value="<s:property value="staff_id"/>" /></td>
							<td><s:property value="staff_id" /></td>
							<td><s:property value="staff_name" /></td>
							<td><s:property value="designation" /></td>
							<td><s:property value="joining_date" /></td>
							<td><s:property value="phone_number" /></td>
							<td><s:property value="address_line" /></td>
							<td><s:property value="city" /></td>
							<td><s:property value="state" /></td>
							<td><s:property value="country" /></td>
							<td><s:property value="email_id" /></td>
							<td><s:property value="staff_type" /></td>
							<td><s:property value="role" /></td>
							<td><s:property value="roll_number" /></td>
							<td><s:property value="acc_no" /></td>





							<td><a
								href="editstaffdetails.action?staff_id=<s:property value="staff_id"/>">Edit</a></td>
							<td><a
								href="deletestaffdetails.action?staff_id=<s:property value="staff_id"/>">Delete</a></td>

						</tr>

					</s:iterator>

				</tbody>
			</table>

			<div align="right">
				<input type="submit" value="Delete Selected Values" />
			</div>
		</form>

	</div>
</body>
</html>